<layout name="layout" />
                <div class="page-header"><!-- Page header -->
                    <h5><i class="font-home"></i>友情链接管理</h5>               
                </div><!-- /page header -->
                <div class="body">                
                    <!-- Content container -->
                    <div class="container"> 
                	
                        <!-- Site Summary -->
                        <div class="block well">                	

                        	<div class="navbar"><div class="navbar-inner"><h5><i class="font-th-list"></i>友情链接列表</h5></div></div>
                            <ul class="toolbar">
                                <li><a href="{:U('Admin/Link/add')}"><i class="font-plus"></i><span>添加链接</span></a></li>
                                <li><a href="{:U('Admin/Link/edit')}" checkbox="true" class="dialog-action"><i class="font-pencil"></i><span>编辑链接</span></a></li>
                                <li><a href="{:U('Admin/Link/delete')}" message="确定要删除选中的链接吗？" dialog="true" checkbox="true" class="dialog-action"><i class="font-remove"></i><span>批量删除</span></a></li>
                                <li><a href="{:U('Admin/Link/cache')}" dialog="after" checkbox="false" class="dialog-action"><i class="font-refresh"></i><span>更新缓存</span></a></li>
                            		<li class="rightbar"><form method="GET" class="navbar-form pull-right" action="{:U('Admin/Seokey/search')}">
                            			<button type="button" onclick="checkLink()" class="btn btn-small btn-success"><i class="icon-search"></i>开始检查</button>&nbsp;&nbsp;
                            			<button type="button" onclick="stopcheck()" class="btn btn-small btn-danger"><i class=" icon-off"></i>停止检查</button>
                            			</form></li>
                            </ul>
                              
<div class="table-overflow">
<TABLE class="table table-block table-bordered table-checks">
<thread><tr>
	<th><input type="checkbox" class="style checkboxall" /></th>
	<th>标题</th>
	<th>LOGO</th>
	<th>URL</th>
	<th>BR</th>
	<th>PR</th>
	<th>首页显示</th>
	<th>状态</th>
	<th></th>
</tr></thread>
<tbody>
<volist name="list" id="vo">
<tr class="row">
	<td class="notallow"><input type="checkbox" value="{$vo.id}" class="style checkboxrow" /></td>
	<td><a href="{:U('Admin/Link/edit?id='.$vo['id'])}">{$vo.title}</a></td>
	<td>{$vo.logo|showLogo}</td>
	<td>{$vo.url}</td>
	<td>{$vo.baidu_br}</td>
	<td>{$vo.google_pr}</td>
	<td><if condition="$vo[isindex] eq 1"><i class="font-ok"></i></if></td>
	<td><if condition="$vo[status] eq 1"><i class="font-ok"></i></if></td>
	<td class="notallow">
		<a href="{:U('Admin/Link/edit?id='.$vo['id'])}"><i class="font-pencil"></i> 编辑</a> &nbsp;&nbsp;&nbsp;
		<a href="{:U('Admin/Link/delete')}" message="确定要删除链接【{$vo.title}】吗？" params="id={$vo.id}" dialog="true" checkbox="false" class="dialog-action"><i class="font-remove"></i> 删除</a></td>
</tr>
<tr><td></td><td colspan="8" style="border-left:none;">
		百度收录： {$vo.baidu_count}<if condition="$vo[baidu_index]">&nbsp;&nbsp;<font color="red">[首页不在第一位]</font></if>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<if condition="$vo[baidu_date]">百度快照： {$vo.baidu_date|toDate='Y-m-d'}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</if>
		检查时间： {$vo.update_time|toDate='Y-m-d'}<br/>
		反链地址： 
		<eq name="vo.linktype" value="0"><font color=grey>正在检查...</font></eq>
		<eq name="vo.linktype" value="4"><font color=red>无反链</font></eq>
		<eq name="vo.linktype" value="3"><font color=blue>无法访问</font></eq>
		<eq name="vo.linktype" value="1">
			<font color=green>{$vo.linkurl}</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			反链类型： 文本&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			链接文字： {$vo.linktext}
		</eq>
		<eq name="vo.linktype" value="2">
			<font color=green>{$vo.linkurl}</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			反链类型： 图片
		</eq>
</td></tr>
</volist>
</tbody>
</table>
</div>
<div class="table-footer">
	{$page}
</div>
</div>
</div>
</div>

<SCRIPT LANGUAGE="JavaScript">
<!--
var mt, ischeck;
jQuery(document).ready(function(){
		//mt = setInterval(checkLink,1000);
		ischeck = 1;
});

function checkLink(){
		var url = "{:U('Admin/Link/linkcheck')}?ischeck="+ischeck;
		jQuery.post(url, function(result){
				if(result == 'end'){
					clearInterval(mt);
					alert('链接已检查完成');
				}else{
				  jQuery('.checklink li:first').after(result);
				  var count = jQuery('.checklink li.link').size();
				  if(count > 20)jQuery('.checklink li.link:first').remove();
					clearInterval(mt);
					mt = setInterval(checkLink,5000);
				}
		});
}

function stopcheck(){
		ischeck = 0;
		clearInterval(mt);
}
//-->
</SCRIPT>